<template>
    <div>
        <el-form ref="formRef" :model="data" :rules="formRules">
            <el-form-item label="类型名称" prop="typeName">
                <el-input v-model="formData.typeName" placeholder="请输入类型名称"></el-input>
            </el-form-item>
            <el-form-item>
                <template #default>
                    <el-button type="primary" @click="submit">提交</el-button>
                    <el-button @click="cancel">取消</el-button>
                </template>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
import {ref, reactive} from "vue";
import {useRouter} from "vue-router";

const emit = defineEmits(["submit", "cancel"])

const props = defineProps(["data"])
const formRef = ref()
const formData = ref({...props.data})
const formRules = ref([])

function submit() {
    emit('submit', formData)
}

function cancel() {
    // formRef.value.resetFields()
    emit('cancel')
}
</script>

<style scoped>

</style>